<template>
  <div
    id="echartsOne"
    class="echartsOne"
  />
</template>

<script>
var echarts = require("echarts");
export default {
  mounted() {
    var chartDom = document.getElementById("echartsOne");
    var myChart = echarts.init(chartDom);
    var option;

    option = {
      title: {
        text: "直播次数分析",
      },
      tooltip: {
        trigger: "axis",
      },
      grid: {
        left: "3%",
        right: "4%",
        bottom: "3%",
        containLabel: true,
      },
      toolbox: {
        feature: {
          saveAsImage: {},
        },
      },
      xAxis: {
        type: "category",
        boundaryGap: false,
        data: [
          "2021-1",
          "2021-2",
          "2021-3",
          "2021-4",
          "2021-5",
          "2021-6",
          "2021-7",
        ],
      },
      yAxis: {
        type: "value",
      },
      series: [
        {
          name: "邮件营销",
          type: "line",
          stack: "总量",
          data: [120, 132, 101, 134, 90, 230, 210],
          smooth: true,
        },
        {
          name: "联盟广告",
          type: "line",
          stack: "总量",
          data: [220, 182, 191, 234, 290, 330, 310],
          smooth: true,
        },
        {
          name: "搜索引擎",
          type: "line",
          stack: "总量",
          data: [820, 932, 901, 934, 1290, 1330, 1320],
          smooth: true,
        },
      ],
    };

    option && myChart.setOption(option);
  },
};
</script>

<style lang="scss" scoped>
.echartsOne {
  width: 49%;
  height: 300px;
  background: #fff;
  margin-bottom: 10px;
  box-shadow: 0 0 10px #cccc;
  border-radius: 5px;
  padding: 5px;
}
</style>